package com.learn;

import javax.sql.DataSource;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.alibaba.druid.pool.DruidDataSource;

//@Configuration
//@ConfigurationProperties(prefix="spring.datasource")
public class DBConfig {

	private String driverClassName;
	private String url;
	private String username;
	private String password;
	
	@Bean
	public DataSource createDataSource(){
		DruidDataSource ds = new DruidDataSource();
		ds.setDriverClassName(driverClassName);
		ds.setUrl(url);
		ds.setUsername(username);
		ds.setPassword(password);
		return ds;
	}
}
